package org.zoomdev.zoom.common.filter.impl;

import org.zoomdev.zoom.common.filter.MethodFilter;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

public final class AnnotationMethodFilter implements MethodFilter {

    private final Class<? extends Annotation> annotationClass;

    public AnnotationMethodFilter(Class<? extends Annotation> annotationClass) {
        this.annotationClass = annotationClass;
    }


    @Override
    public boolean accept(Class<?> clazz, Method method) {
        return clazz.isAnnotationPresent(annotationClass) ||
                method.isAnnotationPresent(annotationClass);
    }
}
